/*
 PreferenceController.h
 iSpeLL
 
 Created by liulei on 5/24/10.
 Copyright 2010 cool8jay@qq.com. All rights reserved.
 */

#import <Cocoa/Cocoa.h>
#import "Constants.h"
#import "UKLoginItemRegistry.h"
#import "WindowAdditions.h"
#import "SRRecorderControl.h"

@class ISpeLLController,PTHotKey;

@interface PreferenceController : NSWindowController {
	ISpeLLController *iSpeLLController;
	
	IBOutlet NSWindow *preferencesWindow;
	
	IBOutlet NSButton *showTipCheckbox;
	IBOutlet NSButton *alwaysOnTopCheckbox;
	IBOutlet NSButton *showDockIconCheckBox;
	IBOutlet NSButton *runAtLogonCheckBox;
	
	IBOutlet NSView *preferenceViewGeneral;
	IBOutlet NSView *preferenceViewAppearance;
	IBOutlet NSView *preferenceViewHotkey;
	IBOutlet NSView *preferenceViewUpdate;
	
	IBOutlet SRRecorderControl	*mainRecorder;
	PTHotKey *mainHotKey;
	
	NSToolbar *toolbar;
	
	NSToolbarItem *toolbarItemGeneral;
	NSToolbarItem *toolbarItemAppearance;
	NSToolbarItem *toolbarItemHotkey;
	NSToolbarItem *toolbarItemUpdate;	
}

@property (retain) IBOutlet SRRecorderControl *mainRecorder;

- (id)initWithSpellController:(ISpeLLController *)controller;

- (IBAction)changeShowTip:(id)sender;
- (BOOL)isShowTip;

- (IBAction)changeAlwaysOnTop:(id)sender;
- (BOOL)isAlwaysOnTop;

- (IBAction)changeShowDockIcon:(id)sender;
- (BOOL)isShowDockIcon;

- (IBAction)changeRunAtLogin:(id)sender;
+ (BOOL)isRunAtLogin;

- (void)restartISpeLL;

- (IBAction)displayPreferenceGeneral:(id)sender;
- (IBAction)displayPreferenceAppearance:(id)sender;
- (IBAction)displayPreferenceHotkey:(id)sender;
- (IBAction)displayPreferenceUpdate:(id)sender;

-(void)registerHotkeyForShowingMainWindow:(unsigned int)flags Code:(signed short)code AtInit:(BOOL)atInit;
-(void)unregisterShortcutKey;

@end
